package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner sc = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("pw.txt", true);
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);

        /**
         * 简易记事本
         */
        String a = "exit";


        System.out.println("请输入");
        while (true) {
            String str = sc.next();
            if (!"exit".equals(str)) {
                pw.println(str);
//                pw.write(str);
//                pw.write('\n');//换行，转义字符
                System.out.println("继续输入");
            } else {
                System.out.println("再见");
                pw.close();
                break;
            }
        }
        pw.close();
    }
}
